package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	ItemSkuEventNew           = "wms.ItemSkuNew"
	ItemSkuEventBeforeCreate  = "wms.ItemSkuBeforeCreate"
	ItemSkuEventBeforeUpdate  = "wms.ItemSkuBeforeUpdate"
	ItemSkuEventBeforeSave    = "wms.ItemSkuBeforeCreate wms.ItemSkuBeforeUpdate"
	ItemSkuEventAfterCreate   = "wms.ItemSkuAfterCreate"
	ItemSkuEventAfterUpdate   = "wms.ItemSkuAfterUpdate"
	ItemSkuEventAfterSave     = "wms.ItemSkuAfterCreate wms.ItemSkuAfterUpdate"
	ItemSkuEventDelete        = "wms.ItemSkuDelete"
	ItemSkuAccessControlEvent = "wms.ItemSkuAccessControl"
)

func GetItemSkuConfig() *mgo.DocConfig {
	return ItemSku_Config
}

var ItemSku_Config *mgo.DocConfig

func init() {
	ItemSku_Config = NewItemSkuConfig()
}
func NewItemSkuConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "wms.ItemSku",
		Fields: []string{
			"itemBase", "text", "code", "unit", "unitBase", "unitExchange", "version", "isOn",
		},
		RelationFields: []string{
			"itemBase", "unit",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"itemBase": {
				Config:     GetItemBaseConfig,
				DocName:    "ItemBase",
				JoinType:   "O",
				KeyInside:  "itemBaseId",
				KeyOutSide: "id",
			},
			"unit": {
				Config:     GetUnitConfig,
				DocName:    "Unit",
				JoinType:   "O",
				KeyInside:  "unitId",
				KeyOutSide: "id",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
